
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
import { CommonEntity } from "./common.entity";
import { SysDept } from './framework/system/SysDept';
import { MajorEntity } from './major.entity';
import { StudentEntity } from './user/student.entity';
import { GroupEntity } from './group.entity';
@Entity('grade', {
	comment: '年级信息表',
	schema: "public"
})
export class GradeEntity extends CommonEntity {
	@PrimaryGeneratedColumn({ type: 'integer', name: 'grade_id', comment: '年级ID' })
	gradeId: number;

	@Column({ type: 'integer', name: 'dept_id', default: null, comment: '学院ID' })
	deptId: number;

	@Column({ type: 'character varying', name: 'grade_name', default: null, comment: '年级名称' })
	gradeName: string;

	@Column({ type: 'character varying', name: 'remark', default: null, comment: '备注' })
	remark: string;

	@Column({ type: 'character', name: 'status', default: '0', comment: '状态（0正常 1停用）' })
	status: string;

	@Column({ type: 'character', name: 'del_flag', default: '0', comment: '删除标志（0代表存在 2代表删除）' })
	delFlag: string;

	@ManyToOne(() => SysDept, (sysDept) => sysDept.children)
	@JoinColumn({ name: 'dept_id' })
	dept: SysDept;
	@OneToMany(() => MajorEntity, (majorEntity) => majorEntity.grade)
	children: MajorEntity[];
	@OneToMany(() => StudentEntity, (studentEntity) => studentEntity.grade)
	students: StudentEntity[];
	@OneToMany(() => GroupEntity, (groupEntity) => groupEntity.grade)
	groups: GroupEntity[];
}
